<?php

class webstat_model extends MY_Model 
{
	public function __construct() 
	{
		parent::__construct();
	}
	
	public function logStatistic( $actionType, $actionHexEncodedData )
	{
		try
        {
			$instance = DbPdo::getInstance();
            $statement = $instance->prepare( "INSERT INTO webstats( id, actiondatetime, event, actiondata ) VALUES( nextval('webstatsequence'), now(), :event, :actiondata )" );
            $statement->bindParam( ":event", $actionType, PDO::PARAM_INT );
            $statement->bindParam( ":actiondata", $actionHexEncodedData, PDO::PARAM_STR );
            $statement->execute();
        }
        catch(PDOException $e)
        {
            logError( __METHOD__ . ": " . $e->getMessage() );
            return false;
        }
		
		return true;
	}
}
?>
